<?php

namespace yiike\store\models;

use Yii;
use \yiike\store\models\base\OrderStore as BaseOrderStore;
use yii\helpers\ArrayHelper;

/**
 * This is the model class for table "ims_ttyc_order_store".
 */
class OrderStore extends BaseOrderStore
{
    public static $status_order = 0;
    public static $status_pay = 1;
    public static $status_express = 2;
    public static $status_finish = 3;
    public static $status_cancel = 4;

    public $status_option =[
        0 => [0 => '待付款', 1 => '待核销', 2 => '', 3 => '交易完成', 4 => '交易取消'],
        1 => [0 => '待付款', 1 => '已付款', 2 => '已发货', 3 => '交易完成', 4 => '交易取消'],
        2 => [0 => '待付款', 1 => '已付款', 2 => '已发货', 3 => '交易完成', 4 => '交易取消']
    ];

    public $is_pay_option = [0 => '未付款', 1 => '已付款'];

    public $is_refund_option = [0 => '', 1 => '已退款'];

    public function behaviors()
    {
        return ArrayHelper::merge(
            parent::behaviors(),
            [
                # custom behaviors
            ]
        );
    }

    public function rules()
    {
        return ArrayHelper::merge(
            parent::rules(),
            [
                # custom validation rules
            ]
        );
    }

    public function attributeLabels()
    {
        return ArrayHelper::merge(
            parent::attributeLabels(),
            [
                'trade_id' => '订单号',
                'pay_at' => '付款时间',
            ]
        );
    }


    /**
     * @return \yii\db\ActiveQuery
     */
    public function getOrderGoods()
    {
        return $this->hasMany(\yiike\store\models\OrderGoods::className(), ['order_id' => 'order_id']);
    }
}
